﻿using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Security.Principal;
using System.ServiceModel;
using System.Web.Security;
using System.ServiceModel.Activation;

namespace BreadWebRole
{
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class DailyBreadDataService : DataService<DailyBreadDataServiceContext>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            // config.SetEntitySetAccessRule("MyEntityset", EntitySetRights.AllRead);
            // config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
            //config.SetEntitySetAccessRule("Amens", EntitySetRights.All);
            //config.SetEntitySetAccessRule("Users", EntitySetRights.All);
            //config.SetEntitySetAccessRule("Breads", EntitySetRights.All);
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            config.UseVerboseErrors = true;

            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
        }


        //[WebGet]
        //public IQueryable<RetrieveAmen_Result> RetrieveAmen(string userId)
        //{

        //    return CurrentDataSource
        //      .RetrieveAmen(userId)
        //      .AsQueryable();
        //}

        //[WebGet]
        //public IQueryable<Comment> GetComments(string url)
        //{

        //    return CurrentDataSource
        //      .GetComments(url)
        //      .AsQueryable();
        //}

    }
}
